package io.aicn.lowcode.controller;

import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.test.context.ContextConfiguration;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@ContextConfiguration(classes = {
    UserController.class,
    io.aicn.lowcode.service.MockUserService.class,
    io.aicn.lowcode.TestApplicationConfig.class
})
@WebMvcTest(controllers = UserController.class)
@ComponentScan(basePackages = "io.aicn.lowcode", 
    excludeFilters = {
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, 
            classes = {io.aicn.lowcode.mapper.UserMapper.class,
                      io.aicn.lowcode.generator.MybatisPlusCodeGenerator.class,
                      io.aicn.lowcode.generator.independent.IndependentCodeGenerator.class,
                      io.aicn.lowcode.controller.CodeGeneratorController.class,
                      io.aicn.lowcode.controller.DatabaseTableController.class,
                      io.aicn.lowcode.controller.IndependentCodeGeneratorController.class,
                      io.aicn.lowcode.service.DatabaseSchemaService.class,
                      io.aicn.lowcode.service.UserService.class}),
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, 
            classes = {org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class})
    })
public @interface UserControllerTestConfig {
}